-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Form Collaboration: Replace Poxa with Action Cable #3105
base: main
Are you sure you want to change the base?
Conversation
@@ -842,7 +842,7 @@ window.FormValidation = | |||
qRef = question.attr("data-question_ref") | |||
qTitle = $.trim(question.find("h2").first().text()) | |||
|
|||
if typeof console != "undefined" | |||
if typeof console != "undefined" && false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[TODO] remove once testing is complete - this output will muddy the waters
21b863b
to
e021984
Compare
get_member_info: (m) -> | ||
return ("ID: " + m.id + ", NAME: " + m.info.name + ", JOINED AT: " + m.info.joined_at) | ||
current_editor_id: () -> | ||
editor_id = window.current_channel_members.split("/").find((el) => el.includes("EDITOR")).split(":")[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just reuse current_editor()
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch, I've updated
collaborators += "/#{user.id}:#{params["current_tab"]}:#{user.email}:#{user.full_name}" | ||
end | ||
|
||
Rails.cache.write(params["channel_name"], collaborators) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just keep collaborators
as an array as it should be automatically serialised? Or do we need to do it this way so we know how to unserialise it in the JS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah the JS does rely on the members being separated by a slash
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but if you pass in an array it must serialise it in its own way. might be neater if we depend on that instead
@@ -93,6 +94,10 @@ def should_enable_js? | |||
helper_method "#{award}_submission_started_deadline" | |||
end | |||
|
|||
def set_session_identifier | |||
cookies["public_tab_ident"] = cookies["_qae_session#{"_development" if Rails.env.development?}"]&.first(8) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the first(8)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It just gets the first 8 characters, as a way of telling the tabs apart for one user
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah so its an identifier for the tab, which is always 8 chars long?
…ng forms behaviour Implements two main behaviours using ActionCable: 1. If a second user has the same section of a form open, they cannot edit it. However if the first user closes their tab or moves on to a different section then editing rights are released to the second user. 2. If user 1 opens a second tab of the same form, they cannot edit in the second tab. They are shown a message telling them to close the tab and edit in the first tab.
f87be1a
to
0adafca
Compare
📝 A short description of the changes
🔗 Link to the relevant story (or stories)
Deployment implications
✅ Checklist
🖼️ Screenshots (if appropriate - no PII/Prod data):
If the first user moves away from that form section, closes their tab etc, then editing should be released to the second user.
This should have a similar effect but with a slightly different warning message. The user can close either tab, and the remaining one will be able to edit.